﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class BaseButton : MonoBehaviour
{
    [SerializeField] protected Button button;
    [SerializeField] protected string buttonText;
    // Start is called before the first frame update
    protected virtual void Start()
    {
        button = transform.GetComponent<Button>();
        if (button != null)
        {
            button.onClick.AddListener(OnButtonClick);
            button.GetComponentInChildren<Text>().text = buttonText;
        }
    }

    protected virtual void OnButtonClick()
    {
        Debug.Log("Base button clicked!");
        // 共同的点击逻辑
    }
    // Update is called once per frame
    void Update()
    {
        
    }
}
